﻿using System;
using System.Configuration;
using Infrastructure.Interfaces;

namespace Infrastructure.Services
{
    public class CustomConfigurationManager : IConfigurationManager
    {
        public string LoginUrl
        {
            get { return ConfigurationManager.AppSettings["LoginUrl"]; }
        }

        public string UserNameHtmlElementId
        {
            get { return ConfigurationManager.AppSettings["UserNameHtmlElementId"]; }
        }

        public string PasswordHtmlElementId
        {
            get { return ConfigurationManager.AppSettings["PasswordHtmlElementId"]; }
        }

        public string SubmitButtonName
        {
            get { return ConfigurationManager.AppSettings["SubmitButtonName"]; }
        }

        public string LoginSuccessTitle
        {
            get { return ConfigurationManager.AppSettings["LoginSuccessTitle"]; }
        }

        public string GetValue(string key)
        {
            var result =  ConfigurationManager.AppSettings[key];
            return !string.IsNullOrEmpty(result) ? result : key;
        }
    }
}
